// 通用响应接口
export interface ApiResponse<T = never> {
  code: number
  message: string
  data: T
}

// 分页请求参数
export interface PaginationParams {
  page: number
  page_size: number
  [key: string]: unknown
}

// 分页响应数据
export interface PaginationResponse<T> {
  items: T[]
  total: number
  page: number
  pageSize: number
}

// 脚本信息接口
export interface Script {
  id: number
  name: string
  path?: string
  description?: string
  version?: string
  content?: string
  author?: string
  type?: string
  createTime?: string
  updateTime?: string
  latestUpdateTime: string
}

// 服务器信息接口
export interface ServerInfo {
  id: number
  room_id: number
  cabinet_id: number
  hostname: string
  server_brand: string
  server_model: string
  sn: string
  height: number
  location: number
  purchase_date: string
  warranty_expiry: string
  notes: string
  status: 'online' | 'offline' | 'undeployed'
  [key: string]: unknown
}

export interface RoomInfo {
  room_id: number
  room_name: string
  location: string
  building_name: string
  floor_number: number
  total_cabinets: number
  used_cabinets: number
  available_cabinets: number
  total_power_capacity: number
  used_power_capacity: number
  available_power_capacity: number
  temperature: number
  humidity: number
  status: string
  firsystem_status: string
  cooling_system_status: string
  security_level: string
  contact_person: string
  contact_phone: string
  installation_date: string | null
  maintenance_date: string | null
  notes: string
}

export interface CabinetInfo {
  cabinet_id: number
  cabinet_name: string
  location: string
  room_id: number
  rack_units: number
  used_units: number[]
  available_units: number
  power_capacity: number
  power_used: number
  power_available: number
  network_ports: number
  used_network_ports: number
  available_network_ports: number
  temperature: number
  humidity: number
  status: string
  installation_date: string
  last_maintenance_date: string
  notes: string
  manufacturer: string
  model: string
  serial_number: string
  weight_capacity: number
  current_weight: number
  power_distribution_unit: string
  network_switch: string
}

// 工作流脚本
export interface WorkflowScript {
  tid: string
  name: string
  description: string
  status: string
  step: string
}

// 工作流章节
export interface WorkflowChapter {
  cid: string
  name: string
  tags: WorkflowScript[]
}

// 工作流
export interface Workflow {
  id: number
  name: string
  type: number
  label: string[]
  author: string
  description: string
  chapters: WorkflowChapter[]
  updateTime: string
  createTime: string
}

// 工作流列表响应
export interface WorkflowResponse {
  items: Workflow[]
  total: number
}

// BMC信息接口
export interface BMCInfo {
  id: number
  server_id: number
  ip_address: string
  mac_address: string
  username: string
  password: string
  firmware_version: string
}

// 网卡信息接口
export interface NetworkCard {
  id: number
  server_id: number
  brand: string
  model: string
  type: string
  status: string
  speed: string
  mac_address: string
  sn: string
  health_status: string
}

// 网口信息接口
export interface NetworkPort {
  id: number
  server_id: number
  network_card_id: number
  mac_address: string
  ip_address: string
  status: string
}
